package com.easou.ps.utils;


public class OtherInfoUtil {
	/**
	 * 网页编码类型
	 * 
	 * @param num
	 */
	public static long getPageEncodeType(long num) {
		return num & 0xF;
	}

	/**
	 * url动态级别
	 * 
	 * @param num
	 * @return
	 */
	public static long getUrlLevel(long num) {
		return (num >> 4) & 0xF;
	}
	/**
	 * 问答整合类型
	 * @param num
	 * @return
	 */
	public static long getWendaType(long num){
		return (num >> 8) & 0x7;
	}
	
	public static boolean isWenda(long num) {
		return getWendaType(num) > 0;
	}
	
	/**
	 * 垂直数据类型
	 * 
	 * @param num
	 * @return
	 */
	public static short getDataType(long num) {
		return (short) ((num >> 11) & 0xFFF);
	}
	
	/**
	 * 从开始到上一次修改的时间间隔
	 * 
	 * @param num
	 * @return
	 */
	public static long getLastEditTimelongerval(long num) {
		return (num >> 23) & 0x1FF;
	}

	/**
	 * 获取语言类型
	 * @param num
	 * @return
	 */
	public static long getLanaguageType(long num){
		return (num>>32)& 0xF;
	}
	
	/**
	 * 获取httpType
	 * @param num
	 * @return
	 */
	public static byte getHttpType(long num){
		return (byte) ((num >> 36) & 0xF);
	}
	
	/**
	 * 获取httpType
	 * @param num
	 * @return
	 */
	public static String getHttpTypeValue(long num){
		byte httpType = getHttpType(num);
		if(httpType == 1){
			return "WAP1.0";
		}else if(httpType == 2){
			return "WAP2.0";
		}else if(httpType == 3){
			return "WEB";
		}
		return "";
	}

	/**
	 * 垃圾论坛页类型
	 */
	public static long getRubblishBbsType(long num) {
		return (num >> 40) & 0x3;
	}

	/**
	 * tag title长度
	 * 
	 * @param num
	 * @return
	 */
	public static long getTagTitleLength(long num) {
		return (num >>42) & 0x3F;
	}
	
	/**
	 * homePage
	 */
	public static long getHomePage(long num) {
		return (num >>48) & 0x1;
	}
	
	/**
	 * staticPage
	 */
	public static long getStaticPage(long num) {
		return (num >>49) & 0x1;
	}
	
	/**
	 * queryposThree
	 */
	public static long getQueryposThree(long num){
		return (num >>50) & 0x1;
	}
	
	/**
	 * 是否是vip数据
	 */
	public static boolean isVip(long num){
		return ((num >>51) & 0x1) > 0;
	}
	
	/**
	 * 时间有效性值   0 超级敏感  1如百科   2如知道  3 如新闻
	 */
	public static long getTimeEffective(long num){
		return (num >>52) & 0x3;
	}
	
	/**
	 * 网页质量 (0~63)
	 */
	public static long getPageQuality(long num){
		return (num >>54) & 0x3F;
	}
	
}
